package cn.com.cloudpioneer.evaluate.controller;

import cn.com.cloudpioneer.evaluate.model.TargetModel;
import cn.com.cloudpioneer.evaluate.service.TargetService;
import cn.com.cloudpioneer.evaluate.utils.CustomException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @auther maruikai
 * @create 2023/9/18-17:48
 */
@RestController
@RequestMapping("/api/xgs/target")
@Api(tags = "指标管理")
public class TargetController extends BaseController {

    @Autowired
    private TargetService targetService;

    @RequestMapping(value = "/set", method = RequestMethod.POST)
    @ApiOperation("添加指标")
    public Object addTarget(@RequestBody TargetModel targetModel) throws CustomException {
        return targetService.addTarget(targetModel);
    }

    @RequestMapping(value = "/update", method = RequestMethod.POST)
    @ApiOperation("编辑指标")
    public Object setTarget(@RequestBody TargetModel targetModel) throws CustomException {
        return targetService.setTarget(targetModel);
    }

    @RequestMapping(value = "/del",method = RequestMethod.POST)
    @ApiOperation("删除指标")
    public Object delTarget(@RequestParam String targetId) throws CustomException {
        return targetService.targetId(targetId);
    }


}
